<!DOCTYPE html>
<html style="font-size: 23.4375px;">
<head>
    <include file="./public/header.html"/>
<body style="font-size: 21.7589px;">
<div id="app">
    <div id="shadow" style="display: none;"></div>
    <header class="top"><span style="display: none;">加载中...</span> <span>设置安全密码</span> <!---->
        <div class="iconfont back" style="display: none;"></div>
        <a href="./securityCenter.html" class="iconfont back"></a>
    </header>

    <div data-v-23f07895="" class="main" s="[object Object]">
        <input type="hidden" id="uid" value="{$uid}">
        <input type="hidden" id="type" value="{$type}">
        <table data-v-23f07895="">
            <tbody data-v-23f07895="">
            <tr data-v-23f07895="">
                <td data-v-23f07895="">安全密码</td>
                <td data-v-23f07895=""><input data-v-23f07895="" type="password" id="pass1" tag="安全密码"
                                              placeholder="请输入安全密码"
                                              class="va47" name="Password"></td>
            </tr>
            <tr data-v-23f07895="">
                <td data-v-23f07895="">确认密码</td>
                <td data-v-23f07895=""><input data-v-23f07895="" type="password" id="pass2" tag="确认密码"
                                              placeholder="请再次输入安全密码"
                                              class="va47" name="checkPassword"></td>
            </tr>
            <tr data-v-23f07895=""></tr>
            </tbody>
        </table>
        <div data-v-23f07895="" class="loginBtn BTN"><a data-v-23f07895="" onclick="sav()">确定</a></div>
        <div data-v-23f07895="" class="tips">
            安全密码用于提现、绑定银行卡等操作，可保障资金安全。
        </div>
    </div>
    <!--密码不为空-->
    <div id="safe1" class="layermbox layermbox0 layermshow" index="21" style="display: none;">
        <div class="laymshade"></div>
        <div class="layermmain">
            <div class="section">
                <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                    <button class="layermend"></button>
                    <div class="layermcont">-安全密码不能为空-</div>
                    <div class="layermbtn"><span type="1">确定</span></div>
                </div>
            </div>
        </div>
    </div>
    <!--密码不为空-->
    <div id="safe2" class="layermbox layermbox0 layermshow" index="21" style="display: none;">
        <div class="laymshade"></div>
        <div class="layermmain">
            <div class="section">
                <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                    <button class="layermend"></button>
                    <div class="layermcont">-确认安全密码不能为空-</div>
                    <div class="layermbtn"><span type="1">确定</span></div>
                </div>
            </div>
        </div>
    </div>
    <!--两次输入的新密码不一致-->
    <div id="safe3" class="layermbox layermbox0 layermshow" index="21" style="display: none;">
        <div class="laymshade"></div>
        <div class="layermmain">
            <div class="section">
                <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                    <button class="layermend"></button>
                    <div class="layermcont">-两次输入的安全密码不一致，请重新输入-</div>
                    <div class="layermbtn"><span type="1">确定</span></div>
                </div>
            </div>
        </div>
    </div>
    <!--新密码设置成功-->
    <div id="safe4" class="layermbox layermbox0 layermshow" index="21" style="display: none;">
        <div class="laymshade"></div>
        <div class="layermmain">
            <div class="section">
                <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                    <button class="layermend"></button>
                    <div class="layermcont">-安全密码设置成功-</div>
                    <div class="layermbtn"><span type="1">确定</span></div>
                </div>
            </div>
        </div>
    </div>
    <!--跳转绑定银行卡-->
    <div id="safe5" class="layermbox layermbox0 layermshow" index="21" style="display: none;">
        <div class="laymshade"></div>
        <div class="layermmain">
            <div class="section">
                <div class="layermchild layerConfirm layermanim"><h3 style="">温馨提示</h3>
                    <button class="layermend"></button>
                    <div class="layermcont">-安全密码已设置成功,是否立即绑定银行卡-</div>
                    <div class="layermbtn">
                        <span type="0" class="fou">否</span>
                        <span type="1" class="shi">是</span>
                    </div>
                </div>
            </div>
        </div>
    </div>


</div>
</body>
</html>
<script>
    $(".layermbtn").click(function () {
        $(this).parents(".layermbox").hide();
    });
    $(".fou").click(function(){
        $(".layermbox").hide();
        location.href = "{:U('Users/userCenter')}";
    })
    $(".shi").click(function () {
        location.href = "{:U('Users/manageBankcard2')}";
    })

    function sav() {
        var id = $("#uid").val();
        var type= $("#type").val();
        var pass1 = $("#pass1").val();
        var pass2 = $("#pass2").val();
        if (pass1 == "") {
            $("#safe1").show();
            return false;
        }
        if (pass2 == "") {
            $("#safe2").show();
            return false;
        }
        if (pass2 != pass1) {
            $("#safe3").show();
            return false;
        }
        $.ajax({
            type: "POST",
            url: "{:U('Users/setSafePwd')}",
            data: {'id': id, 'pass': pass2,'type':type},
            success: function (dat) {
                if (dat==1) {
                    $("#safe4").show();
                }else{
                    $("#safe5").show();
                }
            }
        });

    }
    $("#safe4").click(function () {
        window.location.href = "/Users/securityCenter";
    })
</script>